/* OPTIONS OBS=10000 NOREPLACE; */

/* Construct a dataset of 6-digit NAICS industry cost shares. */

/*include libraries for this project; */
%include "ASMimplibs.sas";


/* Read in aggregate input costs for labor, intermediates and energy, and 
   aggregate real stocks of capital from NBER-CES Productivity Database. 
   (6-digit NAICS level). */

/* NAICS 327320 = ready-mix concrete. */
data nberces_concrete (keep = NAICS YEAR PAY MATCOST ENERGY EQUIP PLANT);
 set nberces.naics5809;
 if year ge 2002 and year le 2007 and NAICS='327320';
run;


/* Read in BLS capital data and merge with nberces data: */

data BLS_capital_327;
 set bls.BLS_capital_327;
 if year ge 2002 and year le 2007;
run;
proc sort data=BLS_capital_327; by year; run;
proc sort data=nberces_concrete; by year; run;

data cost_shares_concrete (keep = NAICS YEAR iake iaks ial iam iae);
 merge BLS_capital_327 nberces_concrete;
 by year;
 tc = eqrkl_base97*EQUIP + strkl_base97*PLANT + PAY + MATCOST;
 iake = eqrkl_base97*EQUIP/tc;
 iaks = strkl_base97*PLANT/tc;
 ial = PAY/tc;
 iam = (MATCOST - ENERGY)/tc;
 iae = ENERGY/tc;
run;

proc datasets library=work;
 modify cost_shares_concrete;
  label iake = 'Industry Average Cost Share, Capital Equipment';
  label iaks = 'Industry Average Cost Share, Capital Structures';
  label ial = 'Industry Average Cost Share, Labor';
  label iam = 'Industry Average Cost Share, Materials';
  label iae = 'Industry Average Cost Share, Energy';
run;

data indcs.cost_shares_concrete;
 set cost_shares_concrete;
run;

proc print data=indcs.cost_shares_concrete;
title1 "Industry Cost Shares, Ready-Mix Concrete";
run;